package funs

import (
	"github.com/CocaineCong/secret"
)

//aes 对称加密和解密
//https://zhuanlan.zhihu.com/p/131324301

// Ase加密签名
var specialSign = "af@zydhfff-]_[;ldp#09@8,[2ps1zx;./"

// AesEncoding 加密  	//key := "458796" // key 密钥
func AesEncoding(key, encodeString string) string {
	aesEncrypt, _ := secret.NewAesEncrypt(specialSign, key, "", secret.AesEncrypt128, secret.AesModeTypeCTR)
	return aesEncrypt.SecretEncrypt(encodeString)
}

// AesDeCoding 解密
func AesDeCoding(key, decodeString string) string {
	aesEncrypt, _ := secret.NewAesEncrypt(specialSign, key, "", secret.AesEncrypt128, secret.AesModeTypeCTR)
	return aesEncrypt.SecretDecrypt(decodeString)
}
